package com.example.demo.spring.ioc.case01;

import java.io.*;
import java.util.Properties;

/**
 * 操作属性文件类（负责加载配置文件，将配置的类信息加载进内存）
 * @author: htc
 * @date: Created in 13:56 2019/1/10.
 */
public class Property {
    public static Properties getPro() throws IOException {
        Properties pro = new Properties();
        File file = new File("fruit.properties");
        if (file.exists()){
            pro.load(new FileInputStream(file));
        }else {
            pro.setProperty("apple","com.example.swap.spring.ioc.case01.Apple");
            pro.setProperty("orange","com.example.swap.spring.ioc.case01.Orange");
            pro.store(new FileOutputStream(file), "FRUIT CLASS");
        }
        return pro;
    }
}
